<?
$section_data = $args->section_data;
?>

<section class="contact-sect" id="<?=$args->section['alias']?>">
    <div class="main-block center">
        <div class="contact">
            <h2><?=$section_data['name']?></h2>
            <div id="adress"><?=$section_data['address']?></div>
        </div>
    </div>
    <div class="map" id="map">

    </div>
    <script src="http://api-maps.yandex.ru/2.0/?load=package.full&lang=ru-RU" type="text/javascript"></script>
    <script>
        ymaps.ready(init2);
        function init2 () {
            var address = $('#adress').text();

            ymaps.geocode(address, { results: 1 }).then(function (res) {
                var firstGeoObject = res.geoObjects.get(0);
                var myMap = new ymaps.Map('map', {
                        center: firstGeoObject.geometry.getCoordinates(),
                        zoom: 16,
                        behaviors: ['default']
                    }),
                    bounds = myMap.getBounds(),
                    myPlacemark,
                    myCollection = new ymaps.GeoObjectCollection({}, {
                        cursor: 'default',
                        <?if($skin = App::GetRegistry()->obSettings->skin){?>
                            iconImageHref: 'assets/skins/<?=$skin?>/images/map_icon.png',
                        <?}else{?>
                            iconImageHref: 'assets/images/map_icon.png',
                        <?}?>

                        iconImageSize: [60, 65], // размеры картинки,
                        iconOffset: [-30, -25]
                    });
                var point =    firstGeoObject.geometry.getCoordinates();

                myPlacemark = new ymaps.Placemark(point, {});
                myCollection.add(myPlacemark);
                myMap.geoObjects.add(myCollection);
// var balloon = myMap.balloon.open(myMap.getCenter(), { content: 'г. Челябинск, ул. 40 лет Победы, 43!' }, { closeButton: false });
                myMap.controls.add('zoomControl').add('mapTools');


            });

        };
    </script>
</section>

